﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading;

namespace MyHttp
{
    class Program
    {
        static void Main(string[] args)
        {
            String port = "9080";
            HttpListener listener = new HttpListener();
            listener.Prefixes.Add("http://+:" + port + "/");
            listener.Start();
            Console.WriteLine("Listening at " + port);
            
            while (true)
            {
                HttpListenerContext context = listener.GetContext();
                new Thread(new HttpHandler(context).handle).Start();
            }
        }
    }
}
